import asyncio
import time


async def test1():
    print("test1-开始时间：", time.time())
    for i in range(10):
        print("----我是test1----")
        await asyncio.sleep(1)
    print("test1-结束时间：", time.time())


async def test2():
    print("test2-开始时间：", time.time())
    for i in range(10):
        print("----我是test2----")
        await asyncio.sleep(2)
    print("test2-结束时间：", time.time())


async def main():
    task1 = asyncio.create_task(test1())
    task2 = asyncio.create_task(test2())
    print("task1结束了吗? ", task1.done())
    print("task2结束了吗? ", task2.done())
    tasks = [task1, task2]
    await asyncio.wait(tasks)
    print("task1结束了吗? ", task1.done())
    print("task2结束了吗? ", task2.done())


if __name__ == '__main__':
    start_time = time.time()
    asyncio.run(main())
    stop_time = time.time()
    print("总耗时：", stop_time - start_time)
